package com.apeli.design;

import lombok.SneakyThrows;
import org.springframework.stereotype.Component;


/**
 * 消费者
 *
 * @author liming
 * @date 2023 06 07
 */
//@Component
public class OrderConsumer extends Consumer {

    public OrderConsumer(MessagePublisher messagePublisher) {
        this.messagePublisher = messagePublisher;
        messagePublisher.register(this);
    }

    @Override
    @SneakyThrows
    public void consumer(MessagePublisher.Event event) {
        Thread.sleep(5000);
        System.out.println("消费消息："+event);
    }
}
